package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.entity.TlSort;
import com.qf.mapper.SortMapper;
import com.qf.service.SortService;
import com.qf.utils.ResultMsg;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SortServiceImpl extends ServiceImpl<SortMapper, TlSort> implements SortService {

    @Override
    public ResultMsg selectBySortIdAndOne() {
        QueryWrapper<TlSort> wrapper = new QueryWrapper<>();
        wrapper.eq("sort_lev",1);
        List<TlSort> list = super.list(wrapper);
        return ResultMsg.SUCCESS(list);
    }

    @Override
    public ResultMsg selectBySortIdAndTwo(Integer sid) {
        QueryWrapper<TlSort> wrapper = new QueryWrapper<>();
        wrapper.eq("sort_lev",2);
        wrapper.eq("sort_parent",sid);
        List<TlSort> list = super.list(wrapper);
        return ResultMsg.SUCCESS(list);
    }
}
